Redirect fot WARNING_CONTINUE_CVV#47
Conversation
| }; | ||
| } | ||
|
|
||
| if (StatusCode::WarningContinueCVV === $orderCreatedResponse->status->statusCode) { |
There was a problem hiding this comment.
it's getting a lot of ifs here
perhaps it's time to refactor it into some strategies?
Or match statements with private methods at least?
@whatever
There was a problem hiding this comment.
For now, I've changed it to match syntax. That makes it easier to see what's going on here.
69747b0 to
0e03c52
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the PayU CaptureAction flow to treat WARNING_CONTINUE_CVV as a redirectable “continue” status (similar to existing 3DS handling), and extends the integration test suite to cover these redirect scenarios.
Changes:
- Refactor redirect selection in
CaptureAction::execute()using a singlematchto handleSUCCESS,WARNING_CONTINUE_3DS(iframe vs non-iframe), andWARNING_CONTINUE_CVV. - Add integration tests for
WARNING_CONTINUE_3DS(with a data provider for iframe allowed/not allowed) and forWARNING_CONTINUE_CVV. - Adjust test gateway mocking to set payment details as an
ArrayObject.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Action/CaptureAction.php | Adds redirect handling for WARNING_CONTINUE_CVV and consolidates redirect logic for success/3DS/CVV responses. |
| tests/Integration/Action/CaptureActionTest.php | Adds test coverage for 3DS redirect variants and CVV continue redirect behavior. |
Comments suppressed due to low confidence (1)
src/Action/CaptureAction.php:60
- The docblock says
@throws HttpRedirect|IframeHttpRedirect|PayUException, butexecute()can also throw other exceptions from this method body (e.g.,LogicExceptionwhenorderIdis present,InvalidArgumentExceptionfrom recurring token checks). Either broaden the@throwslist or remove it to avoid misleading API documentation.
/**
* @param Capture $request
*
* @throws HttpRedirect|IframeHttpRedirect|PayUException
*/
public function execute($request): void
{
RequestNotSupportedException::assertSupports($this, $request);
$firstModel = PaymentHelper::ensurePayment($request->getFirstModel());
$token = $request->getToken();
$this->convertAction($firstModel, $token);
$model = Model::ensureArrayObject($firstModel->getDetails());
if (!empty($model->orderId())) {
throw new \LogicException('Capture payment with order id present is forbidden.');
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AC